home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
tex
/
td187src.lzh
/
HELPMODU.I
< prev
next >
Wrap
Text File
|
1991-12-14
|
10KB
|
330 lines
IMPLEMENTATION MODULE HelpModule ;
FROM SYSTEM IMPORT ADR, ADDRESS;
FROM Storage IMPORT ALLOCATE, DEALLOCATE;
FROM MagicAES IMPORT OBJECT, RsrcGaddr, RTREE, DISABLED;
FROM WinUtils IMPORT SetWinInfo;
IMPORT CommonData;
IMPORT Dialoge;
IMPORT Diverses;
IMPORT FileIO;
IMPORT GetFile;
IMPORT MagicStrings;
IMPORT MagicSys;
IMPORT RSCindices;
(**
IMPORT RTD;
**)
CONST InfoSize = 65;
HelpSize = 41;
SizeSize = 20;
FlagSize = 4;
IconHelpFile = 'tdhelp.??';
VAR Last : ARRAY [0..255] OF CHAR;
Flag : ARRAY [0..19] OF CHAR;
Size : ARRAY [0..255] OF CHAR;
txt : ARRAY [0..255] OF CHAR;
PROCEDURE DisplayString;
VAR i : INTEGER;
pxy : ARRAY [0..3] OF INTEGER;
BEGIN
FOR i:=0 TO InfoSize-1 DO txt[i] := ' '; END;
txt[InfoSize] := 0C;
i := 0;
WHILE (i<FlagSize) AND (Flag[i]<>0C) DO
txt[i] := Flag[i];
INC(i, 1);
END;
i := 0;
WHILE (i<HelpSize) AND (Last[i]<>0C) DO
txt[i + FlagSize] := Last[i];
INC(i, 1);
END;
i := 0;
WHILE (i<SizeSize) AND (Size[i]<>0C) DO
txt[i + FlagSize + HelpSize] := Size[i];
INC(i, 1);
END;
SetWinInfo(CommonData.WindowHandle, txt);
END DisplayString;
PROCEDURE DisplayStatus(txt : ARRAY OF CHAR);
(*
Zeigt im Fenstertitel ein Statusflag an (max. 3 Zeichen)
*)
VAR i : CARDINAL;
adr : ARRAY [0..3] OF INTEGER;
BEGIN
i := 0;
WHILE (i<FlagSize) AND (i<=HIGH(txt)) AND (txt[i]<>0C) DO
Flag[i] := txt[i];
INC(i, 1);
END;
DisplayString;
END DisplayStatus;
PROCEDURE LastHelpMessage;
(* Gibt Inhalt von Last aus *)
VAR i, xp, yp, x, y, w, h, top : INTEGER;
pxy : ARRAY [0..3] OF INTEGER;
BEGIN
IF MagicStrings.Length(Last)> HelpSize THEN
Last[HelpSize-3] := '.';
Last[HelpSize-2] := '.';
Last[HelpSize-1] := '.';
Last[HelpSize ] := 0C;
END;
DisplayString;
END LastHelpMessage;
PROCEDURE WinSize(text : ARRAY OF CHAR);
BEGIN
MagicStrings.Assign(text, Size);
DisplayString;
END WinSize;
PROCEDURE HelpMessage(text : ARRAY OF CHAR);
BEGIN
MagicStrings.Assign(text, Last);
LastHelpMessage;
END HelpMessage;
PROCEDURE HelpFile(HelpNr : INTEGER);
TYPE chset = SET OF CHAR;
CONST helplines = 13;
querverw = 7;
maxlines = 200;
VAR filename : ARRAY [0..255] OF CHAR;
hlpline : ARRAY [0..maxlines-1] OF ARRAY [0..79] OF CHAR;
null : ARRAY [0..19] OF CHAR;
quer : ARRAY [0..querverw-1] OF INTEGER;
helphandle : INTEGER;
i, j, lines : INTEGER;
start, end : INTEGER;
activepage : INTEGER;
helpnr : INTEGER;
prev, next : BOOLEAN;
endofhelp : BOOLEAN;
Tree1,
Tree2,
Tree3 : POINTER TO ARRAY [0..127] OF OBJECT;
num : chset;
BEGIN
helpnr := HelpNr;
Tree1 := RsrcGaddr( RTREE , RSCindices.helpscrn ) ;
Tree2 := RsrcGaddr( RTREE , RSCindices.icons ) ;
Tree3 := RsrcGaddr( RTREE , RSCindices.desktop ) ;
num := chset{'0'..'9'};
REPEAT
endofhelp := TRUE;
(* Zunächst alle Querverweise disablen *)
FOR i:=0 TO querverw-1 DO
quer[i] := 0;
Tree1^[ RSCindices.quer1+i ].ImagePtr := Tree2^[ RSCindices.empty ].ImagePtr ;
INCL(Tree1^[ RSCindices.quer1+i ].obState, DISABLED);
END;
FOR i:=0 TO maxlines-1 DO hlpline[i] := ' '; END;
MagicStrings.Assign(IconHelpFile, null);
null[7] := CHR(ORD('0') + MagicSys.CastToCard(helpnr DIV 10));
null[8] := CHR(ORD('0') + MagicSys.CastToCard(helpnr MOD 10));
IF CommonData.HelpPath[0]<>0C THEN
MagicStrings.Assign(CommonData.HelpPath, filename);
MagicStrings.Append(null, filename);
ELSE
MagicStrings.Assign(null, filename);
END;
null := ' ';
IF GetFile.FileExists(filename) THEN
FileIO.Reset(helphandle, filename);
lines := 0;
FileIO.ReadLn(helphandle, hlpline[lines]);
IF hlpline[0,0] = '_' THEN
(* Jetzt suche die Nummern der Querverweisobjekte *)
j := 0;
i := 1;
REPEAT
WHILE (hlpline[0,i]=' ') DO INC(i); END;
IF (hlpline[0,i] IN num) AND (hlpline[0,i+1] IN num) THEN
quer[j] := 10 * (ORD(hlpline[0,i]) - ORD('0')) +
(ORD(hlpline[0,i+1]) - ORD('0'));
Tree1^[ RSCindices.quer1+j ].ImagePtr :=
Tree3^[ RSCindices.text + quer[j]-1 ].ImagePtr ;
EXCL(Tree1^[ RSCindices.quer1+j ].obState, DISABLED);
ELSE
j := querverw;
END;
INC(j);
INC(i,2);
UNTIL j>=querverw;
hlpline[0] := ' ';
ELSE
IF (hlpline[lines,0] = '.') THEN
hlpline[lines,0] := ' ';
hlpline[lines,1] := 0C;
END;
INC(lines);
END;
WHILE (lines<maxlines) AND (NOT FileIO.EOF) DO
FileIO.ReadLn(helphandle, hlpline[lines]);
IF (hlpline[lines,0] = '.') THEN
hlpline[lines,0] := ' ';
hlpline[lines,1] := 0C;
END;
INC(lines);
END;
FileIO.Close(helphandle);
start := 0;
end := helplines-1;
activepage := 0;
REPEAT
FOR i:=0 TO helplines-1 DO
Tree1^[RSCindices.help01+i].StringPtr := ADR(null);
END;
i := 0;
start := 0;
j := 0;
WHILE (j<activepage) AND (i<lines) DO
IF hlpline[i,0] = '#' THEN
INC(j);
start := i + 1;
ELSE
IF (i-start=helplines) THEN
INC(j);
start := i;
END;
END;
INC(i);
END;
end := start + helplines - 1;
IF end>lines THEN
end := lines;
END;
i := 0;
WHILE (start+i<=end) DO
IF hlpline[start+i,0] = '#' THEN
end := start + i;
i := end;
ELSE
Tree1^[RSCindices.help01+i].StringPtr := ADR(hlpline[start+i]);
END;
INC(i);
END;
prev := start>0;
next := end<lines-1;
j := Dialoge.ShowHelp(prev, next);
IF (j = RSCindices.prevscrn) THEN
IF (activepage>0) THEN
DEC(activepage);
END;
END;
IF (j = RSCindices.nextscrn) THEN
INC(activepage);
END;
UNTIL (j <> RSCindices.prevscrn) AND (j <> RSCindices.nextscrn);
IF (j>=RSCindices.quer1) AND (j<=RSCindices.quer7) THEN
helpnr := quer[j-RSCindices.quer1];
endofhelp := FALSE;
END;
END;
UNTIL endofhelp;
END HelpFile;
PROCEDURE HelpForIcon(nr, FillState, TextState, FontState : INTEGER;
short : BOOLEAN);
(*
Zeigt für das übergebene Icon den entsprechenden Hilfstext an.
Zusätzlich wird der momentane Fill-, Text- und Font-Status über-
geben (da davon manche Texte abhängen).
*)
VAR text : ARRAY [0..127] OF CHAR;
shelp, lhelp : INTEGER;
BEGIN
text := '';
shelp := -1;
lhelp := 0;
IF short THEN
CASE nr OF
RSCindices.spline : shelp := 17; |
RSCindices.polygspl : shelp := 18; |
RSCindices.bezier : shelp := 19; |
RSCindices.bezielli : shelp := 20; |
RSCindices.text :
IF FontState = 0 THEN
CASE TextState OF
0: shelp := 21; |
1: shelp := 22; |
2: shelp := 23; |
3: shelp := 24; |
ELSE
END;
ELSE
CASE TextState OF
0: shelp := 25; |
1: shelp := 26; |
2: shelp := 27; |
3: shelp := 28; |
ELSE
END;
END;